/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity.establishment;

import entity.tx.Places;
import java.io.Serializable;
import java.util.Calendar;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.OneToOne;
import javax.persistence.Temporal;

/**
 *
 * @author Tai Hock
 */
@Entity(name = "Outlet")
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public class Outlet implements Serializable, Comparable {

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    
    private String outletName, operatingHrs;
    private String blkNo, streetName, unitName, postalCode, phoneNo, websiteURL, email, priceRange, image, buildingName;
    private Double latitude, longitude, distance;
    
    @OneToOne(mappedBy = "outlet")
    private Places places;
    
    @Temporal(javax.persistence.TemporalType.TIMESTAMP)
    private Calendar createTime;

    public Calendar getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Calendar createTime) {
        this.createTime = createTime;
    }

    public String getOutletName() {
        return outletName;
    }

    public void setOutletName(String outletName) {
        this.outletName = outletName;
    }

    /**
     * @return the blkNo
     */
    public String getBlkNo() {
        return blkNo;
    }

    /**
     * @param blkNo the blkNo to set
     */
    public void setBlkNo(String blkNo) {
        this.blkNo = blkNo;
    }

    /**
     * @return the streetName
     */
    public String getStreetName() {
        return streetName;
    }

    /**
     * @param streetName the streetName to set
     */
    public void setStreetName(String streetName) {
        this.streetName = streetName;
    }

    /**
     * @return the unitName
     */
    public String getUnitName() {
        return unitName;
    }

    /**
     * @param unitName the unitName to set
     */
    public void setUnitName(String unitName) {
        this.unitName = unitName;
    }

    /**
     * @return the postalCode
     */
    public String getPostalCode() {
        return postalCode;
    }

    /**
     * @param postalCode the postalCode to set
     */
    public void setPostalCode(String postalCode) {
        this.postalCode = postalCode;
    }

    /**
     * @return the phoneNo
     */
    public String getPhoneNo() {
        return phoneNo;
    }

    /**
     * @param phoneNo the phoneNo to set
     */
    public void setPhoneNo(String phoneNo) {
        this.phoneNo = phoneNo;
    }

    /**
     * @return the websiteURL
     */
    public String getWebsiteURL() {
        return websiteURL;
    }

    /**
     * @param websiteURL the websiteURL to set
     */
    public void setWebsiteURL(String websiteURL) {
        this.websiteURL = websiteURL;
    }

    /**
     * @return the email
     */
    public String getEmail() {
        return email;
    }

    /**
     * @param email the email to set
     */
    public void setEmail(String email) {
        this.email = email;
    }

    /**
     * @return the priceRange
     */
    public String getPriceRange() {
        return priceRange;
    }

    /**
     * @param priceRange the priceRange to set
     */
    public void setPriceRange(String priceRange) {
        this.priceRange = priceRange;
    }

    /**
     * @return the image
     */
    public String getImage() {
        return image;
    }

    /**
     * @param image the image to set
     */
    public void setImage(String image) {
        this.image = image;
    }

    /**
     * @return the latitude
     */
    public Double getLatitude() {
        return latitude;
    }

    /**
     * @param latitude the latitude to set
     */
    public void setLatitude(Double latitude) {
        this.latitude = latitude;
    }

    /**
     * @return the longtitude
     */
    public Double getLongitude() {
        return longitude;
    }

    /**
     * @param longtitude the longtitude to set
     */
    public void setLongitude(Double longtitude) {
        this.longitude = longtitude;
    }

    public String getBuildingName() {
        return buildingName;
    }

    /**
     * @param buildingName the buildingName to set
     */
    public void setBuildingName(String buildingName) {
        this.buildingName = buildingName;
    }

    public String getOperatingHrs() {
        return operatingHrs;
    }

    public void setOperatingHrs(String operatingHrs) {
        this.operatingHrs = operatingHrs;
    }

    /**
     * @return the distance
     */
    public Double getDistance() {
        return distance;
    }

    /**
     * @param distance the distance to set
     */
    public void setDistance(Double distance) {
        this.distance = distance;
    }

    /**
     * @return the id
     */
    public Long getId() {
        return id;
    }

    /**
     * @param id the id to set
     */
    public void setId(Long id) {
        this.id = id;
    }

    @Override
    public int compareTo(Object t) {
        return Double.compare(this.getDistance(), ((Outlet) t).getDistance());
    }

    /**
     * @return the places
     */
    public Places getPlaces() {
        return places;
    }

    /**
     * @param places the places to set
     */
    public void setPlaces(Places places) {
        this.places = places;
    }
}
